using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Q.Framework.Utility
{
    public static class FeriadoUtility
    {
        public static DateTime DiaPascoa(int nAno)
        {
            int nRest = (nAno % 19) + 1;
            DateTime oDia = new DateTime();
            switch (nRest)
            {
                case 1: oDia = new System.DateTime(nAno, 4, 14, 0, 0, 0, 0); break;
                case 2: oDia = new System.DateTime(nAno, 4, 3, 0, 0, 0, 0); break;
                case 3: oDia = new System.DateTime(nAno, 3, 23, 0, 0, 0, 0); break;
                case 4: oDia = new System.DateTime(nAno, 4, 11, 0, 0, 0, 0); break;
                case 5: oDia = new System.DateTime(nAno, 3, 31, 0, 0, 0, 0); break;
                case 6: oDia = new System.DateTime(nAno, 4, 18, 0, 0, 0, 0); break;
                case 7: oDia = new System.DateTime(nAno, 4, 8, 0, 0, 0, 0); break;
                case 8: oDia = new System.DateTime(nAno, 3, 28, 0, 0, 0, 0); break;
                case 9: oDia = new System.DateTime(nAno, 4, 16, 0, 0, 0, 0); break;
                case 10: oDia = new System.DateTime(nAno, 4, 5, 0, 0, 0, 0); break;
                case 11: oDia = new System.DateTime(nAno, 3, 25, 0, 0, 0, 0); break;
                case 12: oDia = new System.DateTime(nAno, 4, 13, 0, 0, 0, 0); break;
                case 13: oDia = new System.DateTime(nAno, 4, 2, 0, 0, 0, 0); break;
                case 14: oDia = new System.DateTime(nAno, 3, 22, 0, 0, 0, 0); break;
                case 15: oDia = new System.DateTime(nAno, 4, 10, 0, 0, 0, 0); break;
                case 16: oDia = new System.DateTime(nAno, 3, 30, 0, 0, 0, 0); break;
                case 17: oDia = new System.DateTime(nAno, 4, 17, 0, 0, 0, 0); break;
                case 18: oDia = new System.DateTime(nAno, 4, 7, 0, 0, 0, 0); break;
                case 19: oDia = new System.DateTime(nAno, 3, 27, 0, 0, 0, 0); break;
            }
            
            for (int n = 0; n < 13; n++)
            {
                oDia = oDia.AddDays(1);
                if (oDia.DayOfWeek == DayOfWeek.Sunday)
                    break;
            }

            return oDia;
        }
    }
}